<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="icon" href="images/index.ico">
    <title>我的订单</title>
    <!-- Bootstrap core CSS -->
    <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/order.css">
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="js/order.js"></script>
    <script src="bower_components/moment/moment.js"></script>
    <script src="bower_components/moment-timezone/builds/moment-timezone-with-data.js"></script>
</head>
<body ng-app="orderApp" ng-controller="userCtrl">
<!-- Fixed navbar -->
<nav class="navbar navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
            <a class="navbar-brand logo" href="home.html"><img id="logo" src="images/logo.png" alt=""/></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li ng-show="hasLogin">
                    <a href="userInfo.html">Welcome {{userAccount}}</a>
                </li>
                <li ng-hide="hasLogin"><a href="login.html"><span class="glyphicon glyphicon-user"></span> 登录</a></li>
                <li ng-hide="hasLogin"><a href="register.html"><span class="glyphicon glyphicon-inbox"></span> 注册</a></li>
                <li><a href="home.html"><span class="glyphicon glyphicon-home"></span> 主页</a></li>
                <li ng-show="hasLogin"><a href="order.html"><span class="glyphicon glyphicon-th-list"></span> 我的订单</a></li>
                <li ng-show="hasLogin"><a ng-click="logOut()"><span class="glyphicon glyphicon-log-out"></span> 退出</a></li>
            </ul>
        </div>
        <!--/.nav-collapse -->
    </div>
</nav>

<div class="container" ng-controller="orderCtrl">

    <div class="page-header">
        <div class="alert alert-info" role="alert">
            <h1>我的订单</h1>
        </div>
    </div>
    <div ng-repeat="order in orders" ng-controller="orderListCtrl">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading itemtitle">
                        <span>订单时间： {{order.orderTime}}</span>
                        <span>商家： {{order.merchant.shopName}}</span>
                        <span>总价 : {{order.total}}</span>
                        <a href=""  ng-if="order.score==null&&order.taken==-1" ng-click="showScoreDiv($index)">评分</a>
                        <a href="" ng-if="order.comments==null&&order.taken==-1" ng-click="showComplaintDiv($index)">投诉</a>
                        <button class="btn btn-primary" ng-if="order.comments!=null&&order.taken==-1" data-toggle="modal" data-target="#myModal" ng-click="getComplaintResult($index)">查看投诉结果</button>
                        <button class="btn btn-info" ng-click="showOrderDetail($index)">查看详情</button>
                        <div ng-switch on="order.taken" style="display: inline-block">
                            <button class="btn btn-danger" ng-switch-when="0" disabled>商家未接单</button>
                            <button class="btn btn-success" ng-switch-when="-1" disabled>已收货</button>
                            <button class="btn btn-primary" ng-switch-when="1" ng-click="receiveGoods($index)">确认收货</button>
                            <button class="btn btn-primary" ng-switch-default disabled>商家不接单</button>
                        </div>
                        <ul class="list-group"  ng-show="ulList[$index]">
                            <li class="list-group-item" ng-repeat="dish in order.dishes">
                                <span>菜名：{{dish.dname}}</span>
                                <span>数量：{{dish.num}}</span>
                                <span>单价 : {{dish.price}}</span>
                            </li>
                            <li class="list-group-item"><span>收货地址：{{order.address}}</span></li>
                            <li class="list-group-item" ng-if="order.score!=null&&order.taken==-1"><span>评分：{{order.score}}</span></li>
                            <li class="list-group-item" ng-if="order.comments!=null&&order.taken==-1"><span>投诉内容：{{order.comments}}</span></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="ComplainOverdiv" ng-show="isShowComplaint" ng-controller="complaintCtrl">

        <div id="ComplainInnerdiv">
            <h1>投诉内容</h1>
            <textarea class="form-control" rows="3" ng-model="complaintContent"></textarea>
            <p></p>
            <button type="button" class="btn btn-primary" ng-click="submitComplaint()">提交</button>
            <button type="button" class="btn btn-primary" ng-click="exitComplaint()">退出</button>
        </div>

    </div>


    <div id="ScoreOverdiv" ng-show="isShowScore" ng-controller="scoreCtrl">
        <div id="ScoreInnerdiv">
            <h1>评分</h1>
            <div ng-repeat="sl in starList" style="display: inline-block">
                <div ng-if="$index < fullStarLength&&fullStarLength != 0">
                    <img ng-src="{{fullStar}}" height="12" width="14" ng-click="scoreStar($index)"/>
                </div>
                <div ng-if="$index > fullStarLength-1||fullStarLength == 0">
                    <img ng-src="{{emptyStar}}" height="12" width="14" ng-click="scoreStar($index)"/>
                </div>
            </div>
            <p></p>
            <button type="button" class="btn btn-primary" ng-click="submitScore()">提交</button>
            <button type="button" class="btn btn-primary" ng-click="exitScore()">退出</button>
        </div>

    </div>


    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        投诉结果
                    </h4>
                </div>
                <div class="modal-body" ng-bind="ComplaintResult">

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>



</body>
</html>
